home *** CD-ROM | disk | FTP | other *** search
/ Network Supervisor's Toolkit / Network Supervisor's Toolkit.iso / tools / lu62 / vretry.c < prev    next >
C/C++ Source or Header  |  1996-07-10  |  2KB  |  92 lines

  1.  /*********************************************************
  2.  *                                                        *
  3.  *                     VERB RETRY                         *
  4.  *                   ( v r e t r y )                      *
  5.  *                                                        *
  6.  *   Function : Search for the RCB into the wait queue and*
  7.  *              then pass it for proceed the processing.  *
  8.  *                                                        *
  9.  *   Input  : Pointer to the RCB, pointer to verb code.   *
  10.  *   Output : If verb will be found pass it to the psconv.*
  11.  *                                                        *
  12.  *  CopyRight 1995. Nicholas Poljakov all rights reserved.*
  13.  *                                                        *
  14.  *********************************************************/
  15. #include <stdio.h>
  16. #include <rcb.h>
  17. #include <psp.h>
  18. #include <state1.h>
  19. #include <string.h>
  20.  
  21. struct psp psp_ini;
  22.  
  23. /*
  24.  *  Seek RCB in wait qeue.
  25.  */
  26. int sk_r_wt(p_rcb)
  27. struct rcb *p_rcb;
  28. {
  29.     struct rcb *t_rcb;
  30.  
  31.     if ((t_rcb = psp_ini.wait_chain) == NULL) {
  32.         return (-1);
  33.     }
  34.     while (t_rcb != NULL) {
  35.         if (p_rcb == t_rcb) {
  36.             return (0);
  37.         }
  38.         t_rcb = t_rcb -> next_w;
  39.     }
  40.     return (-1);
  41. }
  42. /*
  43.  *  Insert the RCB into the wait queue.
  44.  */
  45. add_wait(p_rcb)
  46. struct rcb *p_rcb;
  47. {
  48.     struct rcb *t_rcb;
  49.  
  50.     t_rcb = psp_ini.wait_chain;
  51.     if (t_rcb == NULL) {
  52.         psp_ini.wait_chain = p_rcb;
  53.         p_rcb -> next_w = NULL;
  54.         p_rcb -> prev_w = NULL;
  55.         return (0);
  56.     }
  57.     while (t_rcb -> next_w != NULL) {
  58.         t_rcb = t_rcb -> next_w;
  59.     }
  60.     t_rcb -> next_w = p_rcb;
  61.     p_rcb -> prev_w = t_rcb;
  62.     return (0);
  63. }
  64. /*
  65.  *  Delete the RCB from the wait queue.
  66.  */
  67. del_wait(p_rcb)
  68. struct rcb *p_rcb;
  69. {
  70.     struct rcb *t1_rcb;
  71.     struct rcb *t2_rcb;
  72.  
  73.     if (sk_r_wt(p_rcb) == -1) {
  74.         return (-1);
  75.     }
  76.     t1_rcb = p_rcb -> prev_w;
  77.     t2_rcb = p_rcb -> next_w;
  78.     if (t1_rcb == NULL) {
  79.         psp_ini.wait_chain = NULL;
  80.         return (0);
  81.     }
  82.     if (t2_rcb == NULL) {
  83.         t1_rcb -> next_w = NULL;
  84.         return (0);
  85.     }
  86.     p_rcb -> next_w = NULL;
  87.     p_rcb -> prev_w = NULL;
  88.     t1_rcb -> next_w = t2_rcb;
  89.     t2_rcb -> prev_w = t1_rcb;
  90.     return (0);
  91. }
  92.